const Mock = require('mockjs')

const data = Mock.mock({
  'items|30': [{
    id: '@id',
    username: '@name',
    'email|1': ['@email', '@email', '@email'],
    'roles|1-2': [
      {
        'role|1': ['admin', 'editor']
      }
    ],
    'status|1': ['enabled', 'disabled'],
    createTime: '@datetime',
    updateTime: '@datetime'
  }]
})

module.exports = [
  {
    url: '/vue-element-admin/account/list',
    type: 'get',
    response: config => {
      const items = data.items
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items
        }
      }
    }
  },
  {
    url: '/vue-element-admin/account/create',
    type: 'post',
    response: _ => {
      return {
        code: 20000,
        data: 'success'
      }
    }
  },
  {
    url: '/vue-element-admin/account/update',
    type: 'post',
    response: _ => {
      return {
        code: 20000,
        data: 'success'
      }
    }
  },
  {
    url: '/vue-element-admin/account/delete/[A-Za-z0-9]',
    type: 'post',
    response: _ => {
      return {
        code: 20000,
        data: 'success'
      }
    }
  },
  {
    url: '/vue-element-admin/account/status',
    type: 'post',
    response: _ => {
      return {
        code: 20000,
        data: 'success'
      }
    }
  }
]